package cn.rlfit.gulimall.product.entity;

import cn.rlfit.common.validators.AddGroup;
import cn.rlfit.common.validators.ListValue;
import cn.rlfit.common.validators.UpdateGroup;
import cn.rlfit.common.validators.UpdateStatusGroup;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import javax.validation.constraints.*;
import java.io.Serializable;

/**
 * 品牌
 * 
 * @author ruolifeng
 * @email sunruolifeng@gmail.com
 * @date 2023-02-03 12:35:35
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 品牌id
	 * 给校验注解标注什么情况需要进行校验
	 */
	@NotNull(message = "修改必须指定id",groups = UpdateGroup.class)
	@Null(message = "message新增不能指定id",groups = AddGroup.class)
	@TableId
	private Long brandId;
	/**
	 * 品牌名
	 * @NotBlank 开启数据校验：添加校验注解，添加校验提示，并在springMVc中添加校验注解
	 */
	@NotBlank(message = "品牌名必须不为空",groups = {AddGroup.class})
	private String name;
	/**
	 * 品牌logo地址
	 * TODO 后端校验没有完善
	 */
	@NotEmpty(groups = AddGroup.class)
	@NotBlank(message = "logo必须不能是空")
	private String logo;
	/**
	 * 介绍
	 */
	private String descript;
	/**
	 * 显示状态[0-不显示；1-显示]
	 */
	@NotNull(groups = {AddGroup.class, UpdateStatusGroup.class})
	@ListValue(vals = {0,1},groups = {AddGroup.class, UpdateStatusGroup.class})
	private Integer showStatus;
	/**
	 * 检索首字母
	 *
	 */
	@Pattern(regexp = "/^[a-zA-Z]$/",message = "检索首字母必须在a-z或者A-Z之间")
	@NotBlank
	private String firstLetter;
	/**
	 * 排序
	 */
	@NotNull
	@Min(value = 0,message = "排序必须大于等于0")
	private Integer sort;

}
